package com.zx.znav.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zx.znav.bean.Link;
import com.baomidou.mybatisplus.extension.service.IService;

import java.util.List;
import java.util.Map;

/**
* @author lenovo
* @description 针对表【t_link】的数据库操作Service
* @createDate 2023-07-25 14:32:40
*/
public interface LinkService extends IService<Link> {
    List<Link> listLink();
    //分页条件查询 (所属一级导航、所属二级导航、标题)
    Page<Link> pageLink(Link link, Integer pageNo, Integer pageSize);

    //根据一级导航id和二级导航id获取链接列表
    List<Link> listLinkByFirsNavIdAndSecondNavId(Integer firstNavId, Integer secondNavId);

    //根据一级导航id和二级导航id 统计链接数
    Integer countLinkByByFirsNavIdAndSecondNavId(Integer firstNavId, Integer secondNavId);

    //根据二级导航id列出n个链接
    List<Link> listNLinkBySecondNavId(Integer secondNavId, Integer size);


    //根据ids查询
    List<Link> listByIds(List<Integer> ids);

    //全局搜索：根据title brief 模糊查询
    List<Link> search(String input);

    //分组查询，一级导航下的链接数
    List<Map<String, Integer>>groupByFirstNav();

    //将viewCnt + 1
    void increaseViewCnt(Integer id);

    //根据viewCnt 取 前n个
    List<Link> topLink(Integer n);
}